package cn.hicard.auth.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.hicard.auth.dao.SourceDao;
import cn.hicard.auth.entity.MgSource;
import cn.hicard.auth.service.SourceService;
import cn.hicard.auth.web.Node;

/**
 * 资源管理业务接口实现
 * @author zhangy
 *
 */
@Service
public class SourceServiceImpl implements SourceService{

	@Autowired
	private SourceDao sourceDao;

	public void save(MgSource source) throws Exception {
		sourceDao.save(source);
	}

	public void update(MgSource source) throws Exception {
		sourceDao.update(source);
	}

	public void delete(int pkSource) throws Exception {
		sourceDao.delete(pkSource);
	}

	public MgSource getOne(int pkSource) throws Exception {
		return sourceDao.getOne(pkSource);
	}
	
	public List<MgSource> findByParent(int pk) throws Exception {
		return sourceDao.findByParent(pk);
	}
	
	public Node findNodeByType(int rootPk, String type) throws Exception{
		return sourceDao.findNodeByType(rootPk, type);
	}

	public Node findNodeByRoles(int rootPk, List<Integer> roleids) throws Exception {	
		return sourceDao.findNodeByRoles(rootPk, roleids);
	}

}
